<?php

class editCSS extends CourseController {
	
	function index($name) {
		$this->org = $this->orgs->getOrgByName( $name );
		$this->templateVars =  array(
			'title' =>  $this->org[0]['description'] .' - Edit CSS - FEELS ',
			'heading' => $this->org[0]['description'],
			'content' => '<div><p>Click <a href="/editCss">here</a> for help in editing the CSS</p><p>All images that will be used in the CSS can be uploaded at the <a href="/org/view/'.$name.'/photos">Org Graphics</a> section.</p></div>'
			. BufferedView::instance('org/forms/info', array(
				'action' => "/org/view/$name/edit-css/submit",
				'hiddenInputs' => array( 'org_id' => $this->org[0]['org_id'] ),
				'info' => $this->org[0]['css'],
				'orgname' => $name,
				'label' => 'CSS'
			) )->getBuffer(),
			'highlight' => 'orginfo',
			'currentOrg' => $name
		);
	}
	
	function submit($name) {
		$this->orgs->updateCss( $_POST['org_id'], $_POST['info'] );
		header("Location: /org/view/$name");
	}
}